package com.hb.ssmdemo.tools;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 
 * 
 * 获取配置文件中关于图片上传的路径
 *
 *
 **/
public class Configuration {
	private static final String CONFIG_FILE = "args.properties";

	private static Configuration me;

	private Properties props;

	public static Configuration getInstance() {
		if (me == null)
			me = new Configuration();

		return me;
	}

	private Configuration() {
		InputStream is = null;

		try {
			props = new Properties();
			is = Thread.currentThread().getContextClassLoader().getResourceAsStream(CONFIG_FILE);
			props.load(is);
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (is != null)
				try {
					is.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
		}
	}

	/**
	 * 
	 * @Description 在基础参数中以下参数不能删除
	 * 
	 */
	public String getFncode() {
		
		return props.get("fncode").toString();
	}

	
	/**
	 * 
	 * @Description 数据交换机接收端口
	 * 
	 */
	public String getServerPort(){
		
		return props.get("serverPort").toString();
	}
	
	/**
	 * 
	 * @Description 下发次数
	 * 
	 */
	public Integer getSendTotal(){
		
		return Integer.valueOf(props.get("sendTotal").toString());
		
	}
}
